[IA64] Fix vcpu_tranlate()
authorAlex Williamson <alex.williamson@hp.com>
Thu, 7 Feb 2008 16:23:26 +0000 (09:23 -0700)
committerAlex Williamson <alex.williamson@hp.com>
Thu, 7 Feb 2008 16:23:26 +0000 (09:23 -0700)
When handling resion7 opt feature, it should check the range.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/xen/vcpu.c

index 7ba29f3036fd0628b5e5be12e9373f092f21673e..c8d4118f4be5d3d5ab23c6b8471d9f62e9ab1aa1 100644 (file)
@@ -1688,7 +1688,7 @@ vcpu_get_domain_bundle(VCPU * vcpu, REGS * regs, u64 gip,
 IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data,
                         u64 * pteval, u64 * itir, u64 * iha)
 {
-       unsigned long region = address >> 61;
+       unsigned long region = REGION_NUMBER(address);
        unsigned long pta, rid, rr, key = 0;
        union pte_flags pte;
        TR_ENTRY *trp;
@@ -1775,7 +1775,8 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data,
 
                /* Optimization for identity mapped region 7 OS (linux) */
                if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG &&
-                   region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL) {
+                   region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL &&
+                   REGION_OFFSET(address) < _PAGE_PPN_MASK) {
                        pte.val = address & _PAGE_PPN_MASK;
                        pte.val = pte.val | optf->im_reg7.pgprot;
                        key = optf->im_reg7.key;